<template>
	<el-container>
		<el-header>
			<div class="left-panel"></div>
			<div class="right-panel">
				<div class="right-panel-search">
					<el-input v-model.trim="reqParams.sn" style="width: 280px;" clearable placeholder="输入SN查询" />
					<RangeDate @change="rangeDateChange" style="width: 280px;" />
					<el-button icon="el-icon-search" type="primary" @click="search" />
				</div>
			</div>
		</el-header>
		<el-main class="nopadding">
			<scTable
				ref="tableRef"
				tableName="返工记录"
				:api-obj="apiObj"
				:params="reqParams"
				:column="column"
				row-key="id"
				hideContextMenu>
			</scTable>
		</el-main>
	</el-container>
</template>

<script>
import RangeDate from "../../components/RangeDate";

export default {
	components: {
        RangeDate,
    },
	data() {
		return {
			apiObj: this.$API.qc_rework.page,
			reqParams: {
				sn: '',
				startTime: '',
                endTime: '',
			},
			column: [
				{ prop: "id", label: "id", width: 100, hide: true },
				{ prop: 'sn', label: 'SN', width: 240 },
				{ prop: 'ngOpCode', label: 'NG工位编号', width: 100 },
				{ prop: 'recordTime', label: '记录时间', width: 140 },
				{ prop: 'operator', label: '操作人员', width: 120 },
				{ prop: 'content', label: '返工内容' },
			],
		};
	},
	methods: {
		rangeDateChange(rangeDate) {
            if (rangeDate !== null) {
                this.reqParams.startTime = rangeDate[0];
                this.reqParams.endTime = rangeDate[1];
            }
        },
        async search() {
            this.$refs.tableRef.refresh();
        },
	},
};
</script>
